package tech.waterism.enums;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum CatalogEnum {
    // 水库单元（STTP=RR）：汛限水位、正常蓄水位、设计洪水位
    // 河道单元（STTP=ZZ、ZQ）且项目选的是水位：保证水位、警戒水位
    // 河道单元（STTP=ZZ、ZQ）且项目选的是流量：保证流量、警戒流量
    CKFLZ("校核洪水位", "ckflz", "rsvr"),
    DDZ("死水位", "ddz", "rsvr"),
    FSLTDZ("汛限水位", "fsltdz", "rsvr"),
    NORMZ("正常蓄水位", "normz", "rsvr"),
    DSFLZ("设计洪水位", "dsflz", "rsvr"),
    GRZ("保证水位", "grz", "riverZ"),
    WRZ("警戒水位", "wrz", "riverZ"),
    GRQ("保证流量", "grq", "riverQ"),
    WRQ("警戒流量", "wrq", "riverQ"),
    SW("泄流能力", "sw", "extra"),
    INFLOW("入流", "inflow", "extra"),
    INFLOW_MAX("入流峰值", "inflowMax", "extra"),
    INFLOWEARLY_MAX("前期入流峰值", "inflowEarlyMax", "extra"),
    QKEEPOUT("维持出流（前一时段出流）", "qKeepOut", "extra"),
    QOUT_MAX("最大出流", "qoutMax", "extra"),
    GATE_KEEP("前一时段闸门宽度", "gateKeep", "extra");

    private final String name;
    private final String field;
    private final String type;

    CatalogEnum(String name, String field, String type) {
        this.name = name;
        this.field = field;
        this.type = type;
    }

    public static List<CatalogEnum> getByType(String type) {
        return Stream.of(CatalogEnum.values()).filter(catalogEnum -> catalogEnum.type.equals(type))
                .collect(Collectors.toList());
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    public String getField() {
        return field;
    }
}
